package DoublePointSeries;

public class MaxAreaSolution_hot100_11 {
    public int maxArea(int[] height) {
        // 设置两个指针 left right
        int left = 0;
        int right = height.length - 1;
        int result = 0;

        while (left < right) {
            int area = Math.min(height[left], height[right]) * (right - left);
            result = Math.max(area, result);
            if (height[left] < height[right]) {
                left++;
            } else {
                right--;
            }
        }
        return result;
    }
}
